package io.renren.modules.subsys.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.modules.subsys.entity.SubsyssettingEntity;
import io.renren.modules.subsys.service.SubsyssettingService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2022-07-26 20:01:04
 */
@RestController
@RequestMapping("subsys/subsyssetting")
public class SubsyssettingController {
    @Autowired
    private SubsyssettingService subsyssettingService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("subsys:subsyssetting:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = subsyssettingService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{subNo}")
    @RequiresPermissions("subsys:subsyssetting:info")
    public R info(@PathVariable("subNo") Integer subNo){
		SubsyssettingEntity subsyssetting = subsyssettingService.getById(subNo);

        return R.ok().put("subsyssetting", subsyssetting);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("subsys:subsyssetting:save")
    public R save(@RequestBody SubsyssettingEntity subsyssetting){
		subsyssettingService.save(subsyssetting);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("subsys:subsyssetting:update")
    public R update(@RequestBody SubsyssettingEntity subsyssetting){
		subsyssettingService.updateById(subsyssetting);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("subsys:subsyssetting:delete")
    public R delete(@RequestBody Integer[] subNos){
		subsyssettingService.removeByIds(Arrays.asList(subNos));

        return R.ok();
    }

}
